import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-05-02
 * Time: 19:07
 *///TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {

    //汉罗塔问题
public static void hanoi(int num,int n,char move,char auxi,char targ){
    if(num-1==0){
        System.out.println("将"+n+"从"+move+"移到"+targ);
    }else{
        hanoi(num-1,n-1,move,targ,auxi);
        hanoi(1,n,move,auxi,targ);
        hanoi(num-1,n-1,auxi,move,targ);
    }
}
    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入需要转移的盘子个数：");
        int n= scanner.nextInt();

        System.out.println("现在开始模拟"+n+"个盘子从A柱转移到C柱的过程：");
        hanoi(n,n,'A','B','C');

    }
}